package com.zijidelu.luframework.api.model;

import com.zijidelu.luframework.base.valid.BaseValid;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.io.Serializable;

/**
 * API请求对象。
 *
 * @author ZIJIDELU
 * @datetime 2025/4/5 22:06
 */
@Setter
@Getter
public class ApiRequest<T> implements Serializable {

    @Serial
    private static final long serialVersionUID = -7409122443973216672L;

    private final Long timestamp = System.currentTimeMillis();

    @NotBlank(message = "requestId 为必填项", groups = BaseValid.class)
    private String requestId;

    @NotBlank(message = "operator 为必填项", groups = BaseValid.class)
    private String operator;

    @Valid
    @NotNull(message = "payload 为必填项", groups = BaseValid.class)
    private T payload;

}
